
RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0001")
If @error = 1 Then
	Global $resx = RegRead("HKLM\SOFTWARE\PlayOnlineEU\SquareEnix\FinalFantasyXI", "0001")
	Global $resy = RegRead("HKLM\SOFTWARE\PlayOnlineEU\SquareEnix\FinalFantasyXI", "0002")
	Global $install = RegRead("HKLM\SOFTWARE\PlayOnlineEU\Installfolder", "0001")
	$useu = ("EU")
Else
	Global $resx = RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0001")
	Global $resy = RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0002")
	Global $install = RegRead("HKLM\SOFTWARE\PlayOnlineUS\Installfolder", "0001")
	$useu = ("US")
EndIf

Global $resa = @DesktopWidth
Global $resb = @DesktopHeight
Global $resadded = $resx + $resy
Global $winadded = $resa + $resb


Select
	Case $resadded = 1400
		$wr = .585
		$hr = .57
	Case $resadded = 1792
		$wr = .8
		$hr = .745
	Case $resadded = 2016
		$wr = .89
		$hr = .84
	Case $resadded = 2000
		$wr = 1
		$hr = .695
	Case $resadded = 2048
		$wr = 1
		$hr = .745
	Case $resadded = 2240
		$wr = 1
		$hr = .937
	Case $resadded = 2304
		$wr = 1
		$hr = 1
	Case $resadded = 2128
		$wr = 1.0625
		$hr = .745
	Case $resadded = 2384
		$wr = 1.0625
		$hr = 1
	Case $resadded = 2340
		$wr = 1.14
		$hr = .88
	Case $resadded = 2800
		$wr = 1.28
		$hr = 1.185
	Case $resadded = 2730
		$wr = 1.35
		$hr = 1.03
	Case $resadded = 3136
		$wr = 1.45
		$hr = 1.325
	Case $resadded = 3240
		$wr = 1.45
		$hr = 1.425
EndSelect


WinWaitActive("FFXiApp-Windower Enabled")
$RogueTools = GUICreate("Rogue Tools", 1149 * $wr, 200 * $hr, 0, 786 * $hr, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)
GUISetBkColor(0x000000)
$a = CreateRoundRectRgn(16 * $wr, 150 * $hr, 1133 * $wr, 50 * $hr, 200 * $wr, 200 * $hr)
$b = CreateRoundRectRgn(482 * $wr, 0, 200 * $wr, 200 * $hr, 200 * $wr, 200 * $hr)
CombineRgn($a, $b)
SetWindowRgn($RogueTools, $a)
$blm = GUICtrlCreateLabel("", 35 * $wr, 166 * $hr, 15 * $wr, 15 * $hr)
GUICtrlSetTip(-1, "Minimize")
$bl1 = GUICtrlCreateLabel("", 100 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Helpers")
$bl2 = GUICtrlCreateLabel("", 150 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Synthesis/Crafting Bot")
$bl3 = GUICtrlCreateLabel("", 200 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Chocobo Bot")
$bl4 = GUICtrlCreateLabel("", 250 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Mr.Argus")
$bl5 = GUICtrlCreateLabel("", 300 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "POS")
$bl6 = GUICtrlCreateLabel("", 350 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "PC/NPC")
$bl7 = GUICtrlCreateLabel("", 400 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Flee Tool")
$bl8 = GUICtrlCreateLabel("", 450 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Draw Distance")
$bct = GUICtrlCreateLabel("", 562 * $wr, 20 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "MapMon")
$bcl = GUICtrlCreateLabel("", 512 * $wr, 70 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Single Macro Sheet")
$bcc = GUICtrlCreateLabel("", 562 * $wr, 70 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "EXIT")
$bcr = GUICtrlCreateLabel("", 612 * $wr, 70 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Dual Macro Sheet")
$bcb = GUICtrlCreateLabel("", 562 * $wr, 120 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "ACTools")
$br1 = GUICtrlCreateLabel("", 724 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Rogue Fishing Bot")
$br2 = GUICtrlCreateLabel("", 774 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Rogue PowerUp Bot")
$br3 = GUICtrlCreateLabel("", 824 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Rogue Summoning Bot")
$br4 = GUICtrlCreateLabel("", 874 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Rogue Enhancing Bot")
$br5 = GUICtrlCreateLabel("", 924 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Rogue Bard Bot")
$br6 = GUICtrlCreateLabel("", 974 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Rogue Party Bot")
$br7 = GUICtrlCreateLabel("", 1024 * $wr, 155 * $hr, 40 * $wr, 40 * $hr)
GUICtrlSetTip(-1, "Rogue Provoking Bot")
$bru = GUICtrlCreateLabel("", 1075 * $wr, 156 * $hr, 15 * $wr, 15 * $hr)
GUICtrlSetTip(-1, "Page Up")
$brd = GUICtrlCreateLabel("", 1075 * $wr, 176 * $hr, 15 * $wr, 15 * $hr)
GUICtrlSetTip(-1, "Page Down")
GUICtrlCreatePic(@ProgramFilesDir & "\Burnersware\Rogue Tools\Include\img\back.jpg", 16 * $wr, 0, 1133 * $wr, 200 * $hr)
GUISetState(@SW_HIDE, $RogueTools)
WinActivate("FFXiAPP-Windower Enabled")

$RTM = GUICreate("Rogue Tools", 15 * $wr, 50 * $hr, 0, 934 * $hr, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)
$Show = GUICtrlCreateLabel("", 0, 0, 15 * $wr, 50 * $hr)
GUICtrlCreatePic(@ProgramFilesDir & "\Burnersware\Rogue Tools\Include\img\rtm.jpg", 0, 0, 15 * $wr, 50 * $hr)
GUISetState()
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $RTM, "int", 1000, "long", 0x00080000)
;DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $RogueTools, "int", 500, "long", 0x00040001)
Sleep(250)
WinActivate("FFXiAPP-Windower Enabled")
Sleep(250)
MouseClick("right")
While 1
	$Message = GUIGetMsg()

	If $Message = $GUI_EVENT_CLOSE Or $Message = $bcc Then
		DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $RogueTools, "int", 1000, "long", 0x00090000)
		ProcessClose("HLaunch.exe")
		ProcessClose("XCraft.exe")
		ProcessClose("XChoc.exe")
		ProcessClose("Rogue Macro.exe")
		ProcessClose("Rogue Macro2.exe")
		ProcessClose("Rogue Fishing Bot.exe")
		ProcessClose("Rogue PowerUp Bot.exe")
		ProcessClose("Rogue Summoning Bot.exe")
		ProcessClose("Rogue Enhancing Bot.exe")
		ProcessClose("Rogue Bard Bot.exe")
		ProcessClose("Rogue Party Bot.exe")
		ProcessClose("Rogue Provoking Bot.exe")
		Exit
	EndIf
	If $Message = $blm Then
		Slide_out()
	EndIf
	If $Message = $Show Then
		Slide_in()
	EndIf
	If ProcessExists("POL.exe") Then
		$f = 0
	Else
		ProcessClose("Rogue Tools.exe")
	EndIf
	If $Message = $bl1 Then
		If ProcessExists("HLaunch.exe") Then
			ProcessClose("HLaunch.exe")
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue Tools\add\HLaunch.exe", @ProgramFilesDir & "\Burnersware\Rogue Tools\add\")
		EndIf
	EndIf
	If $Message = $bl2 Then
		If ProcessExists("XCraft.exe") Then
			ProcessClose("XCraft.exe")
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\XCraft\XCraft.exe", @ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\XCraft")
		EndIf
	EndIf
	If $Message = $bl3 Then
		If ProcessExists("SetChoc.exe") Or ProcessExists("XChoc.exe") Then
			ProcessClose("SetChoc.exe")
			ProcessClose("XChoc.exe")
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\XChoc\SetChoc.exe", @ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\XChoc")
		EndIf
	EndIf
	If $Message = $bl4 Then
		If ProcessExists("MrArgusGUI.exe") Then
			WinSetTitle("MrArgusGUI - English", "", "BurntArgus")
			Sleep(250)
			WinActivate("BurntArgus")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\JpPack\MrArgusGUI.exe", @ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\JpPack")
			Sleep(500)
			WinSetTitle("MrArgusGUI - English", "", "BurntArgus")
		EndIf
	EndIf
	If $Message = $bl5 Then
		Run(@ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\JpPack\POSTC.exe", @ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\JpPack")
		Sleep(500)
		WinActivate("BurntPOS")
	EndIf
	If $Message = $bl6 Then
		If ProcessExists("PLaunch.exe") Then
			ProcessClose("PLaunch.exe")
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue Tools\add\PLaunch.exe", @ProgramFilesDir & "\Burnersware\Rogue Tools\add\")
		EndIf
	EndIf
	If $Message = $bl7 Then
		If ProcessExists("FleeTool.exe") Then
			WinSetTitle("NickMan Flee", "", "BurntFleeTool")
			Sleep(250)
			WinActivate("BurntFleeTool")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\JpPack\FleeTool.exe", @ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\JpPack")
			Sleep(500)
			WinSetTitle("NickMan Flee", "", "BurntFleeTool")
		EndIf
	EndIf
	If $Message = $bl8 Then
		If ProcessExists("FFXiDrawDistance.exe") Then
			WinSetTitle("FFXiDrawDistance", "", "BurntDrawDistance")
			Sleep(250)
			WinActivate("BurntDrawDistance")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\FFXiDrawDistance\FFXiDrawDistance.exe", @ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\FFXiDrawDistance")
			Sleep(500)
			WinSetTitle("FFXiDrawDistance", "", "BurntDrawDistance")
		EndIf
	EndIf
	If $Message = $bct Then
		If ProcessExists("FFXIMapMon.exe") Then
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\Mapmon\FFXIMapMon.exe", @ProgramFilesDir & "\Burnersware\Rogue Tools\Include\plugins\Mapmon")
		EndIf
	EndIf
	If $Message = $bcl Then
		If ProcessExists("mac1.exe") Then
			ProcessClose("mac1.exe")
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue Tools\add\mac1.exe", @ProgramFilesDir & "\Burnersware\Rogue Tools\add\")
			WinActivate("FFXiApp-Windower Enabled")
		EndIf
	EndIf
	If $Message = $bcr Then
		If ProcessExists("mac2.exe") Then
			ProcessClose("mac2.exe")
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue Tools\add\mac2.exe", @ProgramFilesDir & "\Burnersware\Rogue Tools\add\")
			WinActivate("FFXiApp-Windower Enabled")
		EndIf
	EndIf
	If $Message = $bcb Then
		If ProcessExists("ACTool.exe") Then
			WinActivate("AC Tool ")
		Else
			Run(@ProgramFilesDir & "\AC Tool\ACTool.exe", @ProgramFilesDir & "\AC Tool")
			Slide_out()
		EndIf
	EndIf

	If $Message = $br1 Then
		If ProcessExists("RFL.exe") Or ProcessExists("Rogue Fishing.exe") Then
			ProcessClose("RFL.exe")
			ProcessClose("Rogue Fishing.exe")
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue tools\o7\RFL.exe", @ProgramFilesDir & "\Burnersware\Rogue tools\o7\")
		EndIf
	EndIf
	If $Message = $br2 Then
		If ProcessExists("RPoL.exe") Or ProcessExists("Rogue PowerUp.exe") Then
			ProcessClose("RPoL.exe")
			ProcessClose("Rogue PowerUp.exe")
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue tools\o7\RPoL.exe", @ProgramFilesDir & "\Burnersware\Rogue tools\o7\")
		EndIf
	EndIf
	If $Message = $br3 Then
		If ProcessExists("RSL.exe") Or ProcessExists("Rogue Summoning.exe") Then
			ProcessClose("RSL.exe")
			ProcessClose("Rogue Summoning.exe")
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue tools\o7\RSL.exe", @ProgramFilesDir & "\Burnersware\Rogue tools\o7\")
		EndIf
	EndIf
	If $Message = $br4 Then
		If ProcessExists("REL.exe") Or ProcessExists("Rogue Enhancing.exe") Then
			ProcessClose("REL.exe")
			ProcessClose("Rogue Enhancing.exe")
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue tools\o7\REL.exe", @ProgramFilesDir & "\Burnersware\Rogue tools\o7\")
		EndIf
	EndIf
	If $Message = $br5 Then
		If ProcessExists("RBL.exe") Or ProcessExists("Rogue Bard.exe") Then
			ProcessClose("RBL.exe")
			ProcessClose("Rogue Bard.exe")
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue tools\o7\RBL.exe", @ProgramFilesDir & "\Burnersware\Rogue tools\o7\")
		EndIf
	EndIf
	If $Message = $br6 Then
		If ProcessExists("RPaL.exe") Or ProcessExists("Rogue Party.exe") Then
			ProcessClose("RPaL.exe")
			ProcessClose("Rogue Party.exe")
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue tools\o7\RPaL.exe", @ProgramFilesDir & "\Burnersware\Rogue tools\o7\")
		EndIf
	EndIf
	If $Message = $br7 Then
		If ProcessExists("RPrL.exe") Or ProcessExists("Rogue Provoking.exe") Then
			ProcessClose("RPrL.exe")
			ProcessClose("Rogue Provoking.exe")
			WinActivate("FFXiApp-Windower Enabled")
		Else
			Run(@ProgramFilesDir & "\Burnersware\Rogue tools\o7\RPrL.exe", @ProgramFilesDir & "\Burnersware\Rogue tools\o7\")
		EndIf
	EndIf
WEnd


Func SetWindowRgn($h_win, $rgn)
	DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFunc ;==>SetWindowRgn

Func CreatePolyRgn($pt)
	Local $ALTERNATE = 1
	Local $buffer = ""

	$pt = StringSplit($pt, ",")
	For $i = 1 To $pt[0]
		$buffer = $buffer & "int;"
	Next
	$buffer = StringTrimRight($buffer, 1)
	$lppt = ($buffer)
	For $i = 1 To $pt[0]
		($lppt, $i, $pt[$i])
	Next
	$ret = DllCall("gdi32.dll", "long", "CreatePolygonRgn", "ptr", ($lppt), "int", Int($pt[0] / 2), "int", $ALTERNATE)
	$lppt = 0
	Return $ret[0]
EndFunc ;==>CreatePolyRgn

Func CreateRoundRectRgn($l, $t, $w, $h, $e1, $e2)
	$ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $l, "long", $t, "long", $l + $w, "long", $t + $h, "long", $e1, "long", $e2)
	Return $ret[0]
EndFunc ;==>CreateRoundRectRgn

Func CombineRgn(ByRef $rgn1, ByRef $rgn2)
	DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 2)
EndFunc ;==>CombineRgn

Func Slide_in()
	GUISetState(@SW_HIDE, $RTM)
	DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $RogueTools, "int", 500, "long", 0x00040001);slide in from left
	GUISetState(@SW_SHOW, $RogueTools)
	WinActivate("FFXiAPP-Windower Enabled")
EndFunc ;==>Slide_in

Func Slide_out()
	DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $RogueTools, "int", 500, "long", 0x00050002);slide out to left
	GUISetState(@SW_SHOW, $RTM)
	WinActivate("FFXiAPP-Windower Enabled")
EndFunc ;==>Slide_out
